﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class testresults : System.Web.UI.Page
{
    private SQLQuery sqlQuery = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["candidate"] == null)
        {
            Response.Redirect("index.aspx");
        }
        loadUserControls();
        sqlQuery = new SQLQuery();
        if (!IsPostBack)
        {
            if (sqlQuery.searchTestResults(mGridView, Session["candidate"].ToString()))
            {
                lbl_msg.Text = "";

            }
            else
            {
                lbl_msg.Text = LocalVariables.SEARCH_NOT_RESULTS;
            }
        }
    }

    private void loadUserControls()
    {
        string path = "panel/menulist.ascx";
        panel_menulist.Controls.Clear();
        UserControl userControl = (UserControl)LoadControl(path);
        panel_menulist.Controls.Add(userControl);
    }

    protected void mGridView_SelectedIndexChanged(object sender, EventArgs e)
    {
        layout_details.Visible = true;
        lbl_examcode.Text = mGridView.SelectedRow.Cells[1].Text;
        lbl_datetest.Text = mGridView.SelectedRow.Cells[2].Text;
        lbl_timecompleted.Text = mGridView.SelectedRow.Cells[3].Text;
        lbl_result.Text = mGridView.SelectedRow.Cells[4].Text;

        sqlQuery.viewQuestionResult(mGridView_question, Session["candidate"].ToString(), lbl_examcode.Text.Trim(), mGridView.SelectedRow.Cells[0].Text);
    }
}
